<?php
chdir('../');

include 'includes/setUp.php';


$qb = $db->createQuery('SELECT partial u.{idUser ,userName} FROM User u WHERE LOWER(u.userName) LIKE \'%'.strtolower($_GET['term']).'%\'');
//$qb->setParameter(1, strtolower($_GET['q']));
//$qb->setMaxResults($_GET['limit']);

$res = $qb->getResult();

$first = true;

echo "[";
foreach ($res as $value) {  
  if($first) {
    $first = !$first;
  } else echo ", ";
  
  echo '"'.$value->UserName.'"';
}
echo "]";